import random

num = random.randint(1, 100)
i = 0
while i < 7:
    i += 1
    answer = int(input("guess: "))
    if answer > num:
        print("猜大了")
    elif answer < num:
        print("猜小了")
    else:
        print("猜对了")
        break
else:  # 循环如果被break，else语句不执行，否则执行
    print("the number: %s" % num)
